package com.example.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.IOException;


@Controller
public class AllController {
    @RequestMapping("testView.do")
    public String getView(){
        System.out.println("test");
        return "redirect:/upload.jsp";
    }

    @RequestMapping("getOneU1/{a}")
    public String updatePro(@RequestParam MultipartFile upload) throws IOException {
        System.out.println(upload);
        String fileName = "E:\\IT\\idea\\springbootdemo1124\\src\\main\\webapp\\" + upload.getOriginalFilename();
        System.out.println(fileName);
        upload.transferTo(new File(fileName));
        return "redirect:/upload.jsp";
    }
}
